<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>天天生鲜-商品列表</title>
	<link rel="stylesheet" type="text/css" href="/css/reset.css">
	<link rel="stylesheet" type="text/css" href="/css/main.css">
	<script src="jquery-1.12.4.min.js"></script>

</head>
<body>
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到天天生鲜!</div>
			<div class="fr">
				<div class="login_info fl">
					欢迎您：<em>张 山</em>
				</div>
				<div class="login_btn fl">
					<a href="login.html">登录</a>
					<span>|</span>
					<a href="register.html">注册</a>
				</div>
				<div class="user_link fl">
					<span>|</span>
					<a href="user_center_info.html">用户中心</a>
					<span>|</span>
					<a href="cart.html">我的购物车</a>
					<span>|</span>
					<a href="user_center_order.html">我的订单</a>
				</div>
			</div>
		</div>		
	</div>

	<div class="search_bar clearfix">
		<a href="index.html" class="logo fl"><img src="/images/logo.png"></a>
		<div class="search_con fl">
			<input type="text" class="input_text fl" name="" placeholder="搜索商品">
			<input type="button" class="input_btn fr" name="" value="搜索">
		</div>
		<div class="guest_cart fr">
			<a href="#" class="cart_name fl">我的购物车</a>
			<div class="goods_count fl">1</div>
		</div>
	</div>

	<div class="navbar_con">
		<div class="navbar clearfix">
			<div class="subnav_con fl">
				<h1>全部商品分类</h1>	
				<span></span>			
				<ul class="subnav">
					<li><a href="#" class="fruit">新鲜水果</a></li>
					<li><a href="#" class="seafood">海鲜水产</a></li>
					<li><a href="#" class="meet">猪牛羊肉</a></li>
					<li><a href="#" class="egg">禽类蛋品</a></li>
					<li><a href="#" class="vegetables">新鲜蔬菜</a></li>
					<li><a href="#" class="ice">速冻食品</a></li>
				</ul>
			</div>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>

	<div class="breadcrumb">
		<a href="/user/index">全部分类</a>
		<span>></span>
		<a href="#">新鲜水果</a>
	</div>

	<div class="main_wrap clearfix">
		<div class="l_wrap fl clearfix">
			<div class="new_goods">
				<h3>新品推荐</h3>
				<ul>
					<li>
						<a href="#"><img src="/images/goods/goods001.jpg"></a>
						<h4><a href="#">进口柠檬</a></h4>
						<div class="prize">￥3.90</div>
					</li>

				</ul>
			</div>
		</div>

		<div class="r_wrap fr clearfix">
			<div class="sort_bar">
				<a href="#" class="active" id="noPrice" value="0" onclick="orderDate()" th:class="${state==0}?'active':''">默认</a>
				<a href="#" value="1" id="needPrice" onclick="orderPrice()" th:class="${state==1}?'active':''" >价格</a>
				<input type="hidden" id="judgeState" th:value="${state}"/>


			</div>

			<ul class="goods_type_list clearfix">
				<li th:each="pp:${pageInfo.list}" >
					<input type="hidden" id="needId" th:value="${pp.cateId}"/>
					<a href="detail.html"><img th:src="@{/images/goods/{fileName}(fileName=${pp.imgFile})}"></a>
					<h4><a href="detail.html" th:text="${pp.title}"></a></h4>
					<div class="operate">
						<span class="prize" th:text="${pp.price}"></span>
						<span class="unit"><i th:text="${pp.price}"></i>/500g</span>
						<a href="#" class="add_goods" title="加入购物车"></a>
					</div>
				</li>


			</ul>

			<div class="pagenation">
				<a href="#" th:onclick="page([[${pageInfo.pageNum-1}]])">上一页</a>
				<a href="#" class="active"th:onclick="page(1)">1</a>
				<a href="#" th:onclick="page(2)">2</a>
				<a href="#" th:onclick="page(3)">3</a>
				<a href="#" th:onclick="page(4)">4</a>
				<a href="#" th:onclick="page(5)">5</a>
				<a href="#" th:onclick="page([[${pageInfo.pageNum+1}]])">下一页></a>
			</div>
		</div>
	</div>

	<div class="footer">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>		
		</div>
		<p>CopyRight © 2016 北京天天生鲜信息技术有限公司 All Rights Reserved</p>
		<p>电话：010-****888    京ICP备*******8号</p>
	</div>

<script type="text/javascript">
	function page(pageNum) {
	    var id=$("#needId").val();
        var state= $("#judgeState").attr("value")
       if (state==null){
           state="";
	   } else {
           if (state==1) {
               state=1;
		   }else {
               state=0;
		   }
	   }


		location.href="/goods/list?pageNum="+pageNum+'&id='+id+'&state='+state;
    }

    function orderPrice() {
        var id=$("#needId").val();
        // var state=$("#needPrice").val();

        var state= $("#needPrice").attr("value")

        location.href="/goods/list?state="+state+"&id="+id;
    }

    function orderDate() {
        var state= $("#noPrice").attr("value")

        var id=$("#needId").val();
        location.href="/goods/list?state="+state+"&id="+id;
    }


</script>
	
</body>
</html>